package com.jlpay.openapi.demo.openmerch.change;

import com.jlpay.open.jlpay.sdk.java.model.openmerch.ProductType;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.change.MerchBaseInfoDto;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.change.MerchBusinessInfoDto;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.change.MerchIdentificationInfoDto;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.change.MerchSettleInfoDto;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.change.request.MerchInfoChangeRequest;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.change.response.MerchInfoChangeResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 商户信息修改
 * @author chenjunhong
 * @date 2024/4/15
 */
public class MerchInfoChangeService {
    private static final Logger LOGGER = LoggerFactory.getLogger(MerchInfoChangeService.class);

    public static void main(String[] args) {
        MerchInfoChangeRequest merchInfoChangeRequest = buildMerchInfoChangeRequest();
        MerchInfoChangeResponse merchInfoChangeResponse = JlpayOpenApiService.openMerchWithCryptoService()
                .post(merchInfoChangeRequest, MerchInfoChangeResponse.class);
        LOGGER.info("商户信息修改响应:{}", JsonUtils.toString(merchInfoChangeResponse));
    }

    private static MerchInfoChangeRequest buildMerchInfoChangeRequest() {
        MerchInfoChangeRequest merchInfoChangeRequest = new MerchInfoChangeRequest();
        // 商户基本信息
        MerchBaseInfoDto merchBaseInfoDto = new MerchBaseInfoDto();
        merchInfoChangeRequest.setBaseInfo(merchBaseInfoDto);
        merchBaseInfoDto.setApplyId("b8659ea518d14c99b78b5ad000a4155a");
        merchBaseInfoDto.setProductType(ProductType.QR_CODE_MERCHANT);
        // 商户经营信息
        MerchBusinessInfoDto merchBusinessInfoDto = new MerchBusinessInfoDto();
        merchInfoChangeRequest.setBusinessInfo(merchBusinessInfoDto);
        merchBusinessInfoDto.setMerchNo("849584358140108");
        // 商户身份信息
        MerchIdentificationInfoDto merchIdentificationInfoDto = new MerchIdentificationInfoDto();
        //merchInfoChangeRequest.setIdentificationInfo(merchIdentificationInfoDto);
        // 商户结算信息
        MerchSettleInfoDto merchSettleInfoDto = new MerchSettleInfoDto();
        //merchInfoChangeRequest.setSettleInfo(merchSettleInfoDto);
        return merchInfoChangeRequest;
    }
}
